﻿using System;

class NumberToText
{
    static void Main()
    {
        Console.Write("Enter integer between 0 and 999: ");
        int n = int.Parse(Console.ReadLine());
        int hundreds, tens, ones;
        if (n >= 0 && n <= 999)
        {
            hundreds = n % 10;
            n = n / 10;
            tens = n % 10;
            n = n / 10;
            ones = n % 10;
        
        switch (ones)
        {
            case 1:
                {
                    Console.Write(" hundred");
                    break;
                }
            case 2:
                {
                    Console.Write(" two hundred");
                    break;
                }
            case 3:
                {
                    Console.Write(" three hundred");
                    break;
                }
            case 4:
                {
                    Console.Write(" four hundred");
                    break;
                }
            case 5:
                {
                    Console.Write(" five hundred");
                    break;
                }
            case 6:
                {
                    Console.Write(" six hundred");
                    break;
                }
            case 7:
                {
                    Console.Write(" seven hundred");
                    break;
                }
            case 8:
                {
                    Console.Write(" eight hundred");
                    break;
                }
            case 9:
                {
                    Console.Write("  nine hundred");
                    break;
                }
            case 0:
                {
                    break;
                }
        }
        switch (tens)
        {
            case 1:
                {
                    if (ones == 0) break;
                    else
                    {
                        Console.Write(" and");break;
                    }
                }
            case 2:
                {
                    Console.Write (" twenty"); break;
                }
            case 3:
                {
                    Console.Write(" thirty"); break;
                }
            case 4:
                {
                    Console.Write(" fourty"); break;
                }
            case 5:
                {
                    Console.Write(" fifty"); break;
                }
            case 6:
                {
                    Console.Write(" sixty"); break;
                }
            case 7:
                {
                    Console.Write(" seventy"); break;
                }
            case 8:
                {
                    Console.Write(" eighty"); break;
                }
            case 9:
                {
                    Console.Write(" ninety"); break;
                }
            case 0:
                {
                    if (ones == 0) break;
                    else if (hundreds == 0) break;
                    else
                    {
                        Console.Write(" and"); break;
                    }
                }
        }
        switch (hundreds)
        {
            case 1:
                {
                    if (tens == 1)
                    {
                        Console.Write(" eleven");
                    }
                    else if (tens == 0 & ones == 0)
                    {
                        Console.Write(" one");
                    }
                    else if (tens == 0)
                    {
                        Console.Write(" one");
                    }
                    else
                    {
                        Console.Write(" one");
                    }
                    break;
                }
            case 2:
                {
                    if (tens == 1)
                    {
                        Console.Write(" twelve");
                    }
                    else if (tens == 0 && ones == 0)
                    {
                        Console.Write(" two");
                    }
                    else if (tens == 0)
                    {
                        Console.Write(" two");
                    }
                    else
                    {
                        Console.Write(" two");
                    }
                    break;
                }
            case 3:
                {
                    if (tens == 1)
                    {
                        Console.Write(" thirteen");
                    }
                    else if (tens == 0 && ones == 0)
                    {
                        Console.Write(" three");
                    }
                    else if (tens == 0)
                    {
                        Console.Write(" three");
                    }
                    else
                    {
                        Console.Write(" three");
                    }
                    break;
                }
            case 4:
                {
                    if (tens == 1)
                    {
                        Console.Write(" forteen");
                    }
                    else if (tens == 0 && ones == 0)
                    {
                        Console.Write(" four");
                    }
                    else if (tens == 0)
                    {
                        Console.Write(" four");
                    }
                    else
                    {
                        Console.Write("four");
                    }
                    break;
                }
            case 5:
                {
                    if (tens == 1)
                    {
                        Console.Write(" fifteen");
                    }
                    else if (tens == 0 && ones == 0)
                    {
                        Console.Write(" five");
                    }
                    else if (tens == 0)
                    {
                        Console.Write(" five");
                    }
                    else
                    {
                        Console.Write(" five");
                    }
                    break;
                }
            case 6:
                {
                    if (tens == 1)
                    {
                        Console.Write(" sixteen");
                    }
                    else if (tens == 0 && ones == 0)
                    {
                        Console.Write(" six");
                    }
                    else if (tens == 0)
                    {
                        Console.Write(" six");
                    }
                    else
                    {
                        Console.Write(" six");
                    }
                    break;
                }
            case 7:
                {
                    if (tens == 1)
                    {
                        Console.Write(" seventeen");
                    }
                    else if (tens == 0 && ones == 0)
                    {
                        Console.Write(" seven");
                    }
                    else if (tens == 0)
                    {
                        Console.Write(" seven");
                    }
                    else
                    {
                        Console.Write(" seven");
                    }
                    break;
                }
            case 8:
                {
                    if (tens == 1)
                    {
                        Console.Write(" eighteen");
                    }
                    else if (tens == 0 && ones == 0)
                    {
                        Console.Write(" eight");
                    }
                    else if (tens == 0)
                    {
                        Console.Write(" eight");
                    }
                    else
                    {
                        Console.Write(" eight");
                    }
                    break;
                }
            case 9:
                {
                    if (tens == 1)
                    {
                        Console.Write(" nineteen");
                    }
                    else if (tens == 0 && ones == 0)
                    {
                        Console.Write(" nine");
                    }
                    else if (tens == 0)
                    {
                        Console.Write(" nine");
                    }
                    else
                    {
                        Console.Write(" nine");
                    }
                    break;
                }
             }
        Console.WriteLine();   
        }
        else
        {
            Console.WriteLine("Incorrect value!");
        }
       
    }
}
